package com.sjzsqjy.asdtiang.mysql;

import java.sql.Timestamp;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;

import com.sjzsqjy.asdtiang.action.AdminAction;

/**
 * Link entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "link", catalog = "hospital")
public class Link implements java.io.Serializable {

	// Fields

	private String id;
	private Long version;
	private String address;
	private String showTitle;

	// Constructors

	/** default constructor */
	public Link() {
	}

	/** full constructor */
	public Link(Long version, String address, String showTitle) {
		this.version = version;
		this.address = address;
		this.showTitle = showTitle;
	}

	// Property accessors
	@GenericGenerator(name = "generator", strategy = "uuid")
	@Id
	@GeneratedValue(generator = "generator")
	@Column(name = "id", unique = true, nullable = false)
	public String getId() {
		return this.id;
	}

	public void setId(String id) {
		this.id = id;
	}

	@Column(name = "version", nullable = false)
	public Long getVersion() {
		return this.version;
	}

	public void setVersion(Long version) {
		this.version = version;
	}

	@Column(name = "address", nullable = false)
	public String getAddress() {
		return this.address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	@Column(name = "show_title", nullable = false)
	public String getShowTitle() {
		return this.showTitle;
	}

	public void setShowTitle(String showTitle) {
		this.showTitle = showTitle;
	}
	public static Link validate(Link object,AdminAction adminAction){
		if(null==object.getAddress()||object.getAddress().equals("")){
			return null;
		}
		if(null==object.getShowTitle()||object.getShowTitle().equals("")){
			return null;
		}
		object.setVersion(1l);
		
		return object;
	}


}